<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link th:href="@{/css/style.css}" rel="stylesheet" type="text/css" />
<script type="text/javascript" th:src="@{/js/jquery.js}"></script>
<script type="text/javascript">
function tipOpen(content) {
	$(".tipright p").text(content);
	$("#tip").fadeIn(200);
}
function tipClose() {
	$("#tip").fadeOut(200);
}
</script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li>采购管理</li>
    <li>厂商管理</li>
    <li>基本内容</li>
  </ul>
</div>
<div class="rightinfo">
  <form id="customForm" th:action="@{/manufacturer/queryByParam}" method="post">
    <ul class="tools">
      <li> 公司名称:
        <input type="text" name="firmName" th:value="${purchaseCFirm==null?'':purchaseCFirm.firmName}"/>
      </li>
      <li> 负责人姓名:
        <input type="text" name="firmFounder" th:value="${purchaseCFirm==null?'':purchaseCFirm.firmFounder}"/>
      </li>
      <li> 所属区域：
        <select name="provinceId" id="provinceId">
          <option value="">请选择省份</option>
          <option th:each="province:${session.provinceList}" th:text="${province.pName}"  th:value="${province.id}" th:selected="${provinceId==province.id}"></option>
        </select>
        <!--回显城市id，存储隐藏域中-->
        <input type="hidden" id="hideCityId" th:value="${purchaseCFirm==null?'':purchaseCFirm.firmCity}"/>
        <select name="firmCity" id="cityId">
          <option value="">请选择城市</option>
          <option th:if="${cityByProvinceId != null}" th:each="city:${cityByProvinceId}" th:text="${city.cName}" th:selected="${city.id==purchaseCFirm.firmCity}" th:value="${city.id}"></option>
        </select>
      </li>
      <li> 状态：
        <select>
          <option value="">请选择</option>
          <option value="1" th:selected="${purchaseCFirm==null?false:purchaseCFirm.status=='1'}">可用</option>
          <option value="0" th:selected="${purchaseCFirm==null?false:purchaseCFirm.status=='0'}">不可用</option>
        </select>
      </li>
      <li class="subBut" onclick="chaxun(1)"><img th:src="@{/images/t06.png}" />查询</li>
      <li class="subBut" onclick="window.location.href='/purchase/manufacturerAdd'"><img th:src="@{/images/t01.png}" />添加</li>
    </ul>
    <table class="tablelist">
      <thead>
        <tr>
          <th>序号</th>
          <th>厂商名称</th>
          <th>负责人</th>
          <th>联系电话</th>
          <th>所属区域</th>
          <th>状态</th>
          <th>创建时间</th>
          <th>创建人</th>
          <th>操作</th>
        </tr>
      </thead>
      <tbody>
      <tr th:each="purchaseCFirm:${session.firmPage.data}">
        <td th:text="${purchaseCFirm.firmId }"></td>
        <td th:text="${purchaseCFirm.firmName}"></td>
        <td th:text="${purchaseCFirm.firmFounder}"></td>
        <td th:text="${purchaseCFirm.firmTel}"></td>
        <td th:text="${purchaseCFirm.firmCity == null ? '' : purchaseCFirm.city.province.PName+purchaseCFirm.city.cName}"></td>
        <td th:text="${purchaseCFirm.status == 1?'可用':'不可用'}"></td>
        <td th:text="${#dates.format(purchaseCFirm.createTime,'yyyy-MM-dd HH:mm:ss')}"></td>
        <td th:text="${purchaseCFirm.getCreateUsers() == null ? '' : purchaseCFirm.getCreateUsers().getUname()}"></td>
        <td>
          <input type="hidden" name="customId">
          <a href="customerView.html" class="tablelink">查看详情</a>
          <a href="customerUpdate.html" class="tablelink">修改</a>
          <a href="javascript:void(0)" class="tablelink" onclick="tipOpen('是否确认注销此条信息？')">注销</a>
          <a href="javascript:void(0);" class="tablelink" onclick="allottipOpen()">分配</a>
        </td>
      </tr>
<!--        <tr>-->
<!--          <td>1</td>-->
<!--          <td>阿里巴巴</td>-->
<!--          <td>王金平</td>-->
<!--          <td>17370899727</td>-->
<!--          <td>江苏南京</td>-->
<!--          <td>可用</td>-->
<!--          <td>2013-09-09 15:05:05</td>-->
<!--          <td>管理员</td>-->
<!--          <td>-->
<!--          	<a href="/purchase/manufacturerView" class="tablelink">查看详情</a>-->
<!--            <a href="/purchase/manufacturerUpdate" class="tablelink">修改</a>-->
<!--            <a href="javascript:void(0)" class="tablelink" onclick="tipOpen('是否确认注销此条信息？')">注销</a>-->
<!--          </td>-->
<!--        </tr>-->
<!--        <tr>-->
<!--          <td>2</td>-->
<!--          <td>腾讯公司</td>-->
<!--          <td>张永祥</td>-->
<!--          <td>17370897894</td>-->
<!--          <td>江苏南京</td>-->
<!--          <td>不可用</td>-->
<!--          <td>2013-09-09 15:05:05</td>-->
<!--          <td>管理员</td>-->
<!--          <td>-->
<!--          	<a href="/purchase/manufacturerView" class="tablelink">查看详情</a>-->
<!--            <a href="javascript:void(0)" class="tablelink" onclick="tipOpen('是否确认恢复此条信息？')">恢复</a>-->
<!--          </td>-->
<!--        </tr>-->
<!--        <tr>-->
<!--          <td>3</td>-->
<!--          <td>阿里巴巴</td>-->
<!--          <td>王金平</td>-->
<!--          <td>17370899727</td>-->
<!--          <td>江苏南京</td>-->
<!--          <td>可用</td>-->
<!--          <td>2013-09-09 15:05:05</td>-->
<!--          <td>管理员</td>-->
<!--          <td>-->
<!--          	<a href="/purchase/manufacturerView" class="tablelink">查看详情</a>-->
<!--            <a href="/purchase/manufacturerUpdate" class="tablelink">修改</a>-->
<!--            <a href="javascript:void(0)" class="tablelink" onclick="tipOpen('是否确认注销此条信息？')">注销</a>-->
<!--          </td>-->
<!--        </tr>-->
<!--        <tr>-->
<!--          <td>3</td>-->
<!--          <td>腾讯公司</td>-->
<!--          <td>张永祥</td>-->
<!--          <td>17370897894</td>-->
<!--          <td>江苏南京</td>-->
<!--          <td>不可用</td>-->
<!--          <td>2013-09-09 15:05:05</td>-->
<!--          <td>管理员</td>-->
<!--          <td>-->
<!--          	<a href="/purchase/manufacturerView" class="tablelink">查看详情</a>-->
<!--            <a href="javascript:void(0)" class="tablelink" onclick="tipOpen('是否确认恢复此条信息？')">恢复</a>-->
<!--          </td>-->
<!--        </tr>-->
      </tbody>
    </table>
    <div class="pagin">
      <div class="message">共<i class="blue">1256</i>条记录，当前显示第&nbsp;<i class="blue">2&nbsp;</i>页</div>
      <ul class="paginList">
        <li class="paginItem"><a href="javascript:;"><span class="pagepre"></span></a></li>
        <li class="paginItem"><a href="javascript:;">1</a></li>
        <li class="paginItem current"><a href="javascript:;">2</a></li>
        <li class="paginItem"><a href="javascript:;">3</a></li>
        <li class="paginItem"><a href="javascript:;">4</a></li>
        <li class="paginItem"><a href="javascript:;">5</a></li>
        <li class="paginItem more"><a href="javascript:;">...</a></li>
        <li class="paginItem"><a href="javascript:;">10</a></li>
        <li class="paginItem"><a href="javascript:;"><span class="pagenxt"></span></a></li>
      </ul>
    </div>
  </form>
  <!-- 提示框 -->
  <div id="tip" class="tip">
    <div class="tiptop"><span>提示信息</span><a onclick="tipClose()"></a></div>
    <div class="tipinfo"> <span><img th:src="@{/images/ticon.png}" /></span>
      <div class="tipright">
        <p></p>
        <cite>如果是请点击确定按钮 ，否则请点取消。</cite> </div>
    </div>
    <div class="tipbtn">
      <input name="" type="button"  class="sure" value="确定" onclick="tipClose()" />
      &nbsp;
      <input name="" type="button"  class="cancel" value="取消" onclick="tipClose()" />
    </div>
  </div>
</div>
<script type="text/javascript">
	$('.tablelist tbody tr:odd').addClass('odd');
    function chaxun(pageNum){
      $("#pageNum").val(pageNum);
      $("#customForm").submit();
    }

    $("#provinceId").change(function (){
      var provinceId = $("#provinceId").val();
      if(provinceId != null && provinceId != ""){
        $.ajax({
          url: "/manufacturer/queryCityListByAjax",
          data: {"provinceId": provinceId},
          dataType: "JSON",
          success:function (data){
            /*清空城市数据*/
            $("#cityId").html("");
            var options = "<option value=''>请选择城市</option>";
            var arr=null;
            if(typeof data=='string')
              arr=JSON.parse(data);
            else
              arr=data;
            $.each(arr, function (i,obj){
              options += "<option value='"
                      + obj.id
                      + "'>"
                      + obj.cname
                      + "</option>";
            });
            $("#cityId").html(options);
          },
          error:function (){
            alert(222);
          }
        });
      }else {
        /*清空城市数据*/
        $("#cityId").html("");
        var options = "<option value=''>请选择城市</option>";
        $("#cityId").append(options);
      }
    });

    function lunbo(pageNum){
      $("#pageNum").val(pageNum);
      $("#customForm").submit();
    }
</script>
</body>
</html>
